package com.yang.factory;

/**
 * Created by Administrator on 2017/5/11.
 */
public class Driver {

    public static Car getCar(String type) throws Exception{

        if(type.equals("Benz")){
            return new Benz();
        }else if(type.equals("Audi")){
            return new Audi();
        }else if(type.equals("Bmw")){
            return new Bmw();
        }else{
            throw new Exception();
        }
    }
}
